package com.supinfo.suptracking.entity;

import java.io.Serializable;
import java.util.Date;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Temporal;

/**
 *
 * @author Fabien, Jérémy, Ludovic, Brice
 */

@Entity
public class Zone implements Serializable {
    
    private static final long serialVersionUID = 1L;
    
    @Id
    @GeneratedValue(strategy = GenerationType.AUTO)
    private Long id;
    
    @ManyToOne 
    @JoinColumn(name = "FK_CAR")
    private Car car;
    
    private String name;
    private String latitude;
    private String longitude;
    private String radiusMeter;
    
    @Temporal(javax.persistence.TemporalType.DATE)
    private Date lowTimeStamp;
    
    @Temporal(javax.persistence.TemporalType.DATE)
    private Date highTimeStamp;

    public Long getId() {
        return id;
    }

    public void setId(Long id) {
        this.id = id;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public Car getCar() {
        return car;
    }

    public void setCar(Car car) {
        this.car = car;
    }

    public String getLatitude() {
        return latitude;
    }

    public void setLatitude(String latitude) {
        this.latitude = latitude;
    }

    public String getLongitude() {
        return longitude;
    }

    public void setLongitude(String longitude) {
        this.longitude = longitude;
    }

    public String getRadiusMeter() {
        return radiusMeter;
    }

    public void setRadiusMeter(String radiusMeter) {
        this.radiusMeter = radiusMeter;
    }

    public Date getLowTimeStamp() {
        return lowTimeStamp;
    }

    public void setLowTimeStamp(Date lowTimeStamp) {
        this.lowTimeStamp = lowTimeStamp;
    }

    public Date getHighTimestamp() {
        return highTimeStamp;
    }

    public void setHighTimestamp(Date highTimestamp) {
        this.highTimeStamp = highTimestamp;
    }
    
    @Override
    public int hashCode() {
        int hash = 0;
        hash += (id != null ? id.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Zone)) {
            return false;
        }
        Zone other = (Zone) object;
        if ((this.id == null && other.id != null) || (this.id != null && !this.id.equals(other.id))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "com.suptracking.entity.Zone[ id=" + id + " ]";
    }
}
